<template>
	<view class="conterherad">
		<u-tabs lineColor="#056de8" :activeStyle="{
				color: '#fff '
			}" :inactiveStyle="{
				color: '#fff '
			}" :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs>
		<!-- 时子沙售出记录 -->
		<view class="sold_box" v-show="current == 0">
			<u-list @scrolltolower="scrolltolower" v-if="collectionList.length != 0">
				<u-list-item v-for="(item, index) in collectionList" :key="index">
					<view class="hass_box">
						<image src="../../static/images/crazy/jinbi.png" mode=""></image>
						<view class="box_number">
							<view>数量：{{ item.buyMemberPropNum }}</view>
							<view class="">单价：{{ item.unitPrice }}</view>
						</view>
						<view class="times">
							<view>
								{{ item.payTime }}
							</view>
							<view class="times_box">总价格：{{ item.sumPrice }}</view>
						</view>
					</view>
				</u-list-item>
			</u-list>
			<view  v-if="collectionList.length == 0">
				<image style="
				width: 280rpx;
				height: 280rpx;
				margin: 200rpx 220rpx 0;
				" src="../../static/images/fighting.gif" mode=""></image>
			</view>
		</view>

		<!-- 时子沙售出记录  -->
		<!-- 萌宝售出记录 -->
		<view class="baby_box" v-if="current == 1">
			<baby></baby>
		</view>
		<!-- 萌宝售出记录 -->
	</view>
</template>
<script>
	import config from '@/config.js';
	import baby from '../../components/baby/baby.vue';
	import {
		sellRecord
	} from '@/api/hassold/hassold.js';
	export default {
		components: {
			baby
		},
		data() {
			return {
				imgUrl: config.imgUrl,
				list: [{
						name: '金豆售出记录'
					},
					{
						name: 'Duck售出记录'
					}
				],
				current: 0,
				page: 1,
				size: 10,
				collectionList: [],
				total: 0
			};
		},
		created() {
			this.getGuildStoreList();
		},
		methods: {
			// 时子沙售出记录
			async getGuildStoreList() {
				let param = {};
				param.page = this.page;
				param.size = this.size;
				const data = await sellRecord(param);
				let _this = this;
				data.data.res.map((i) => {
					_this.collectionList.push(i);
				});
				this.total = data.data.total;
				// console.log(data, "123")
			},
			scrolltolower() {
				//加载时候判断是否还有下一页
				if (this.collectionList.length < this.total) {
					this.page++;
					//则还有下一页
					this.getGuildStoreList();
				}
			},
			change(index) {
				this.current = index.index;
			}
			// 时子沙售出记录
		}
	};
</script>

<style lang="scss" scoped>
	::v-deep .u-tabs__wrapper__nav__item {
		flex: 1;
	}
	// 时子沙售出记录
	.sold_box {
		padding: 34rpx;

		.hass_box {
			width: 680rpx;
			height: 135rpx;

			background: #15142D;
			border-radius: 14rpx;
			display: flex;
			justify-content: space-between;
			padding: 20rpx;
			margin: 0 0 20rpx 0;

			image {
				width: 100rpx;
				height: 100rpx;
			}

			.box_number {
				width: 180rpx;
				font-size: 26rpx;
				font-weight: 400;
				color: #ffffff;
				font-family: "font";

				view {
					padding: 2rpx 0 20rpx 0;
				}
			}

			.times {
				font-size: 26rpx;
				font-weight: 400;
				color: #ffffff;
				font-family: "font";

				.times_box {
					margin-top: 30rpx;
				}
			}
		}
	}

	// 时子沙售出记录
</style>